package com.shaoshaohuo.app.adapter;

import java.util.List;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.shaoshaohuo.app.R;
import com.shaoshaohuo.app.entity.ToolApp;
import com.shaoshaohuo.app.utils.ImageLoadUtil;
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class ToolAppAdapter<T> extends MyBaseAdapter<ToolApp> {

    
	public ToolAppAdapter(Context ctx, List<ToolApp> list, boolean flag) {
		super(ctx, list, flag);
	}

	@Override
	public View getView(int pos, View convertView, ViewGroup group) {
		
		ViewHolder holder;
        if (convertView == null) {
            convertView = View.inflate(context,R.layout.view_tool_item, null);
            holder = new ViewHolder();
            holder.titleText = (TextView) convertView.findViewById(R.id.textview_tool_title);
            holder.toolImage = (ImageView) convertView.findViewById(R.id.imageview_tool_image);
//            holder.moneyText = (TextView) convertView.findViewById(R.id.textview_money);
//            holder.contentText = (TextView) convertView.findViewById(R.id.textview_content);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
		
        ToolApp item = list.get(pos);
        
        holder.titleText.setText(item.getName());
//        LoadUtils.getInstance().loadImage(holder.toolImage, item.getIcon(),option);
        ImageLoader.getInstance().displayImage(item.getIcon(), holder.toolImage,ImageLoadUtil.build);
//        holder.moneyText.setText("￥"+item.getMoney());
        
		return convertView;
	}
	
	static class ViewHolder{
		TextView titleText;
//		TextView moneyText;
//		TextView contentText;
		ImageView toolImage;
	}
	
}
